<template>
  <div>
    <h2>首页</h2>
    <p>22222</p>
    <router-link to="/home/news">新闻</router-link>
    <router-link to="/home/message">消息</router-link>
    <router-view></router-view>
  </div>
</template>

<script>
export default {
  name: "home",
  data() {
    return {
      path: "/home/news"
    };
  },
  created() {
    console.log("首页创建");
  },
  activated() {
    console.log("首页活跃");
    this.$router.push(this.path);
  },
  beforeRouteLeave(to, from, next) {
    console.log(this.$route.path);
    this.path = this.$route.path;
    next();
  }
};
</script>

<style>
</style>